//
//  FruitTableViewCell.m
//  FruitHelper
//
//  Created by 赵隆杰 on 2021/12/11.
//

#import "AddFruitTableViewCell.h"

@interface AddFruitTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imageview;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;


@end

@implementation AddFruitTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.imageview.layer.cornerRadius = 5;
    self.imageview.layer.masksToBounds = YES;
}

- (void)setModel:(FruitModel *)model
{
    _model = model;
    if (model.imageType == 1) {
        UIImage *image = [NSObject Base64StrToUIImage:model.imageStr];
        self.imageview.image = image;
    } else {
        self.imageview.image = [UIImage imageNamed:model.imageStr];
    }
    self.titleLabel.text = [NSString stringWithFormat:@"%@ - %@KG", model.title, model.kg];
    NSString *timeStr = [NSDate timeStringToInterval:model.addTime.doubleValue dataFormat:@"yyyy-MM-dd HH:mm"];
    self.timeLabel.text = [NSString stringWithFormat:@"添加时间：%@", timeStr];
}

@end
